home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12076 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  72 lines

  1. Path: asimov.oit.umass.edu!not-for-mail
  2. From: ekh@asimov.oit.umass.edu (Eugene K Hall)
  3. Newsgroups: comp.lang.c
  4. Subject: Very Simple <maths.h> problem...
  5. Date: 28 Mar 1996 21:29:45 GMT
  6. Organization: University of Massachusetts, Amherst
  7. Message-ID: <4jf0c9$rs8@nic.umass.edu>
  8. NNTP-Posting-Host: asimov.oit.umass.edu
  9. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  10.  
  11. Hi there. I'm getting these errors for a program. It's pathetically easy,
  12. but I can't seem to rectify it. If anyone could help, it would be great:
  13.  
  14. It's supposed to work, the man page lists exp() as a valid math.h funct.
  15. ??
  16.  
  17. Errors:
  18. ------
  19.  
  20. asimov% !cc
  21. cc int.c
  22. ld:
  23. Unresolved:
  24. exp
  25.  
  26. Program:
  27. --------
  28.  
  29. asimov% cat int.c
  30. // Program for 224H to Evaluate an Integral by Summing
  31.  
  32. #include <stdio.h>
  33. #include <math.h>
  34.  
  35. int count;
  36. float x, y, ya, yb, sum;
  37.  
  38. void main()
  39. {
  40.  
  41.   x = 0.01;
  42.   y = 0;
  43.                         /* Find value */
  44.   for (count = 0; count <= 10000; count++)
  45.  
  46.       {
  47.          ya = x*x*x;
  48.          yb = exp(x)-1;
  49.          y  = ya / yb;
  50.          sum += y;
  51.          x += 0.1;
  52.       }
  53.  
  54.  printf("The Final Value = %s", sum);
  55.  
  56. }
  57.  
  58.  
  59.  
  60. =========
  61.  
  62. Any help would be greaty (!) appreciated.
  63.  
  64. Many thanks,
  65. Kevin
  66. (ekh@oitunix.oit.umass.edu)
  67.  
  68.  
  69.  
  70.  
  71.  
  72.